import request from "@/utils/request";
import qs from "qs";
export function getDeviceList(data) {
  return request({
    url: "/device/deviceManager/list",
    method: "post",
    data,
  });
}
export function getMachineList(data) {
  return request({
    url: "/instrument/instrumentInfo/list",
    method: "post",
    data,
  });
}
export function getDeviceDesc(params) {
  return request({
    url: "/device/deviceManager/getDeviceDesc",
    method: "get",
    params,
  });
}
export function getComdListByDeviceIdOrInstrumentId(data) {
  return request({
    url: "/common/comdManager/getComdListByDeviceIdOrInstrumentId",
    method: "post",
    data,
  });
}

export function getMachineDesc(params) {
  return request({
    url: "/instrument/instrumentInfo/getInstrumentDesc",
    method: "get",
    params,
  });
}

export function deleteDevice(data) {
  return request({
    url: "/device/deviceManager/remove",
    method: "post",
    data,
  });
}
export function getSceneList(data) {
  return request({
    url: "/scene/sceneManager/list",
    method: "post",
    data,
  });
}
export function getTmplList(data) {
  return request({
    url: "/tmpl/manager/list",
    method: "post",
    data,
  });
}

export function getOrder(data) {
  return request({
    url: "/common/comdManager/list",
    method: "post",
    data,
  });
}

export function getParamsList(data) {
  return request({
    url: "/common/parmManager/list",
    method: "post",
    data,
  });
}
export function sceneTestParmRecord(data) {
  return request({
    url: "/scene/sceneTestParmRecord/list",
    method: "post",
    data,
  });
}
export function fileList(data) {
  return request({
    url: "/file/manager/list",
    method: "post",
    data,
  });
}

export function fileListPast(data) {
  return request({
    url: "/file/loadRecord/list",
    method: "post",
    data,
  });
}

export function monitorList(data) {
  return request({
    url: "/monitor/operlog/list",
    method: "post",
    data,
  });
}
export function systemList(data) {
  return request({
    url: "/system/user/list",
    method: "post",
    data,
  });
}
export function sceneTestRecordList(data) {
  return request({
    url: "/scene/sceneTestRecord/list",
    method: "post",
    data,
  });
}

/** 获取场景详情 */
export function getSceneDetail(params) {
  return request({
    url: "/scene/sceneManager/getSceneDecs",
    method: "get",
    params,
  });
}

/**
 * 执行检测
 * @param { { childNodeId:string,  executeTime: string } }  data
 */
export function performDetection(data) {
  return request({
    url: "/scene/sceneManager/executeScene",
    method: "post",
    data,
  });
}
export function roleList(data) {
  return request({
    url: "/system/role/list",
    method: "post",
    data,
  });
}
export function menuList(data) {
  return request({
    url: "/system/menu/list",
    method: "post",
    data,
  });
}
export function dictList(data) {
  return request({
    url: "/system/dict/list",
    method: "post",
    data,
  });
}

/** 修改二级节点状态 */
export function editNodeStatus(data) {
  return request({
    url: "/scene/sceneChildNodeManager/edit",
    method: "post",
    data,
  });
}
/** 根据测试场景id获取测试序列执行的测试信息 */
export function getLog(sceneId) {
  return request({
    url: `/system/record/getlistBySceneId/${sceneId}`,
    method: "get",
  });
}
